home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1561 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.1 KB

  1. Path: center.colgate.edu!JWILSON
  2. From: jwilson@center.colgate.edu (KRSNA CONSCIOUSNESS NOW)
  3. Newsgroups: comp.lang.c++
  4. Subject: maybe a FAQ... how to ensure the order in which global constructors are called?
  5. Date: 11 Jan 1996 17:17:38 GMT
  6. Organization: Colgate University
  7. Message-ID: <4d3gni$pmp@inet01.colgate.edu>
  8. Reply-To: jwilson@center.colgate.edu
  9. NNTP-Posting-Host: center.colgate.edu
  10.  
  11.  
  12. Hello, I've looked through the FAQ and couldn't find the answer to the 
  13. eponymous question. My situation is this: I have a container class 
  14. Registry which contains objects of type Handle. I subclassed Handle to
  15. RegisterHandle, and as part of the constructor of RegisterHandle, the new
  16. RegisterHandle is automatically added to a global Registry. Or I would
  17. so; this only works if the global registry has been constructed prior to
  18. the construction of the RegisterHandle. 
  19.  
  20. I realize I could probably get away with using a global Registry pointer
  21. and initializing it if it's NULL in the constructor to RegisterHandle;
  22. however, this seems ugly. Is there a mechanism for ensuring that global
  23. constructors are called in a certain order?
  24.  
  25. Thanks.
  26.  
  27. James Wilson
  28.